const odooModelName = 'res.partner'

const values_default = {
  is_company: true,
  company_id: 2001,
  comment: 'ems,customer'
}

const domain_default = {
  is_company: true,
  company_registry: 'ems',
  comment___like: 'customer'
}

const fields_default = {
  user_id: null,
  child_ids: { name: null, email: null }
}

const filterItems = ['date', 'name___like']

const columns = [
  'name',
  'company_id__name',
  'email',
  'category_id__names',
  'user_id__name',
  'child_ids__count'
]

const table_expand = {
  field: 'child_ids__objects',
  type: 'table',
  columns: ['name', 'email', 'mobile']
}

const formItems = [
  'name',
  'email',
  // 'date',
  // 'is_company',
  // 'type',
  // 'title',
  'category_id'
]

const Model = {
  name: odooModelName,
  configs: {
    values_default,
    domain_default,
    fields_default,
    filterItems,
    columns,
    table_expand,
    formItems
  },
  extend: BaseClass => {
    class ModelClass extends BaseClass {
      global_domain(domain_src = {}) {
        // console.log('this.global_domain in odoo.ResPartnerCompany')
        const domain = { ...domain_src }
        // const userinfo = self.get_userinfo()
        // const { uid } = userinfo
        // domain.user_id = uid
        return super.global_domain(domain)
      }
    }
    return ModelClass
  }
}

export default Model
